﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using Gman.WebApp.ServiceControllers;
using System.IO;


namespace Gman.WebApp.Controllers
{    
    public abstract partial class BaseController : Controller
    {
        private GestionServiceController gestionServiceController = null;
        public GestionServiceController GestionServiceController
        {
            get
            {
                if (gestionServiceController == null)
                    gestionServiceController = new GestionServiceController();
                return gestionServiceController;
            }
            set
            {
                gestionServiceController = value;
            }
        }

        private GeneralServiceController generalServiceController = null;
        public GeneralServiceController GeneralServiceController
        {
            get
            {
                if (generalServiceController == null)
                    generalServiceController = new GeneralServiceController();
                return generalServiceController;
            }
            set
            {
                generalServiceController = value;
            }
        }

        private OperacionServiceController operacionServiceController = null;
        public OperacionServiceController OperacionServiceController {
            get
            {
                if (operacionServiceController == null)
                    operacionServiceController = new OperacionServiceController();
                return operacionServiceController;
            }
            set
            {
                operacionServiceController = value;
            }
        }

        public JsonResult AjaxResultSuccessNoParam()
        {
            return Json(
              new
              {
                  result = true
              });
        }

        public JsonResult AjaxResultSuccess(string message)
        {
            return Json(
                new
                {
                    result = true,
                    message = message
                });
        }

        public JsonResult AjaxResultError(string errorMessage)
        {
            return Json(
              new
              {
                  result = false,
                  errorMessage = errorMessage
              });
        }      

    }
}
